

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserAddressTable extends Migration
{
    public function up()
    {
        Schema::create('user_address', function (Blueprint $table) {
            $table->increments('user_address_id')->comment("用户地址ID,自增");
            $table->integer('user_id')->unsigned()->comment("用户ID");
            $table->char('province',16)->comment("省ID");
            $table->char('city',16)->comment("市ID");
            $table->char('county',16)->comment("县ID");
            $table->string('address')->comment('地址');
            $table->string('phone')->comment('电话');
            $table->string('get_name')->comment('收件人');
            $table->tinyInteger('is_default')->default(1)->comment("是否为默认地址");
            $table->engine = 'InnoDB';
            $table->index('user_address_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_address');
    }
}
